import sys
import os

def main():
    try:
        import uvicorn
        print("启动 FastAPI 应用...")
        uvicorn.run("app.main:app", host="127.0.0.1", port=8000, reload=False)
    except ImportError as e:
        print(f"错误: 缺少必要的依赖包: {e}")
        print("请使用以下命令安装依赖:")
        print("pip install -r requirements.txt")
    except Exception as e:
        print(f"启动应用时出错: {e}")

if __name__ == "__main__":
    main()